﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyWeb.Common;
using MyWeb.Business;
using System.Data;
public partial class Admin_Login : System.Web.UI.Page
{


    protected void btnLogon_Click(object sender, EventArgs e)
    {
            var dt = UserService.User_CheckLogin(txtUsername.Text, StringClass.Encrypt(txtPassword.Text));
            if (dt.Rows.Count > 0)
            {
                int qh;
                qh = Convert.ToInt32(dt.Rows[0]["Role"].ToString());
                if (qh < 3 && qh > 0)
                {
                    Session["Role"] = qh;
                    Session["Username"] = txtUsername.Text.Trim();
                    Response.Redirect("~/Admin/Default.aspx");
                }
                else
                {
                    WebMsgBox.Show("Sai tên đăng nhập hoặc mật khẩu!");
                }
            }

    }


    protected void txtUsername_TextChanged(object sender, EventArgs e)
    {

    }
}